﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace JovensIPR.Component
{
    public partial class SubMenu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Equals(Request.Params["subPage"], null))
            {
                string itemMenu = Request.Params["subPage"].ToString();

                subMenu.FindItem(itemMenu).Selected = true;
            }
        }

        protected void subMenu_MenuItemClick(object sender, MenuEventArgs e)
        {
            if (!Equals(subMenu.SelectedItem, null))
                subMenu.SelectedItem.Selected = false;

            //if (!Equals(subMenu.SelectedItem, null))
            //{
            //    subMenu.SelectedItem.Selected = true;

            //    foreach (MenuItem item in subMenu.Items)
            //    {
            //        if (!Equals(item, subMenu.SelectedItem))
            //            item.Selected = false;
            //    }


            //    string redireciona = Session["page"].ToString() + "&subPage=" + subMenu.SelectedItem.ValuePath;
            //    Session["page"] = redireciona;

            //    switch (subMenu.SelectedValue)
            //    {
            //        case "Nossa liderança":
            //            redireciona = "~/sobre/NossaLideranca.aspx" + redireciona;
            //            break;
            //        default:
            //            Response.Redirect("~/Default.aspx");
            //            break;
            //    }
            //    Response.Redirect(redireciona);
            //}
        }
    }
}